<template>
  <div class="home">
    <div class="welcome-section">
      <h1>欢迎使用 Dx Fun Group 管理系统</h1>
      <p>专业的电竞团队管理平台</p>
    </div>

    <div class="stats-grid">
      <el-card class="stat-card">
        <div class="stat-content">
          <div class="stat-icon">
            <el-icon size="24"><User /></el-icon>
          </div>
          <div class="stat-info">
            <div class="stat-number">{{ stats.players }}</div>
            <div class="stat-label">注册选手</div>
          </div>
        </div>
      </el-card>

      <el-card class="stat-card">
        <div class="stat-content">
          <div class="stat-icon">
            <el-icon size="24"><Trophy /></el-icon>
          </div>
          <div class="stat-info">
            <div class="stat-number">{{ stats.matches }}</div>
            <div class="stat-label">比赛场次</div>
          </div>
        </div>
      </el-card>

              <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon">
              <el-icon size="24"><Avatar /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">{{ stats.teams }}</div>
              <div class="stat-label">战队数量</div>
            </div>
          </div>
        </el-card>

      <el-card class="stat-card">
        <div class="stat-content">
          <div class="stat-icon">
            <el-icon size="24"><DataAnalysis /></el-icon>
          </div>
          <div class="stat-info">
            <div class="stat-number">{{ stats.winRate }}%</div>
            <div class="stat-label">胜率</div>
          </div>
        </div>
      </el-card>
    </div>

    <div class="quick-actions">
      <h2>快速操作</h2>
      <div class="action-grid">
        <el-card class="action-card" @click="navigateTo('/player')">
          <div class="action-content">
            <el-icon size="32"><User /></el-icon>
            <h3>选手管理</h3>
            <p>管理选手信息、段位和擅长位置</p>
          </div>
        </el-card>

        <el-card class="action-card" @click="navigateTo('/competition')">
          <div class="action-content">
            <el-icon size="32"><Trophy /></el-icon>
            <h3>比赛管理</h3>
            <p>安排比赛、记录结果和统计数据</p>
          </div>
        </el-card>

        <el-card class="action-card" @click="navigateTo('/teams')">
          <div class="action-content">
            <el-icon size="32"><Avatar /></el-icon>
            <h3>战队管理</h3>
            <p>管理战队组成和队员分配</p>
          </div>
        </el-card>

        <el-card class="action-card" @click="navigateTo('/statistics')">
          <div class="action-content">
            <el-icon size="32"><DataAnalysis /></el-icon>
            <h3>数据统计</h3>
            <p>查看详细的数据分析和报表</p>
          </div>
        </el-card>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { User, Trophy, Avatar, DataAnalysis } from '@element-plus/icons-vue'

const stats = ref({
  players: 15,
  matches: 28,
  teams: 4,
  winRate: 68
})

const router = useRouter()

const navigateTo = (path: string) => {
  router.push(path)
}
</script>

<style scoped>
.home {
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-section {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 0;
}

.welcome-section h1 {
  font-size: 32px;
  color: #303133;
  margin-bottom: 16px;
}

.welcome-section p {
  font-size: 16px;
  color: #606266;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.stat-info {
  flex: 1;
}

.stat-number {
  font-size: 28px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #909399;
}

.quick-actions {
  margin-top: 40px;
}

.quick-actions h2 {
  font-size: 24px;
  color: #303133;
  margin-bottom: 24px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.action-card {
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.action-content {
  padding: 24px;
}

.action-content .el-icon {
  color: #409EFF;
  margin-bottom: 16px;
}

.action-content h3 {
  font-size: 18px;
  color: #303133;
  margin-bottom: 8px;
}

.action-content p {
  font-size: 14px;
  color: #606266;
  line-height: 1.5;
}
</style>
